<template>
  <div class="wholesale-list block">
    <div class="header">
      <h2 class="title">批发报销售</h2>
      <el-form ref="queryForm" :inline="true" label-position="right" :model="tableQuery">
        <el-form-item label="销售对象" prop="supplierName">
          <el-select
            v-model="tableQuery.saleTargetCode"
            filterable
            remote
            clearable
            placeholder="请输入关键词"
            :remote-method="saleTargetRemoteMethod"
            :loading="loading"
          >
            <el-option
              v-for="item in saleTargetOptions"
              :key="item.saleTargetCode"
              :label="item.saleTargetName"
              :value="item.saleTargetCode"
            />
          </el-select>
        </el-form-item>

        <el-form-item label="经销商名称">
          <el-select
            v-model="tableQuery.companyId"
            filterable
            remote
            clearable
            placeholder="请输入关键词"
            :remote-method="companyNameRemoteMethod"
            :loading="loading"
          >
            <el-option
              v-for="item in companyNameOptions"
              :key="item.companyId"
              :label="item.companyName"
              :value="item.companyId"
            />
          </el-select>
        </el-form-item>

        <el-form-item label="销售日期">
          <el-date-picker
            v-model="saleDate"
            value-format="yyyy-MM-dd HH:mm:ss"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            :default-time="['00:00:00', '23:59:59']"
          ></el-date-picker>
        </el-form-item>
        <el-form-item label="状态">
          <el-select v-model="tableQuery.orderStatus" clearable placeholder="请选择">
            <el-option label="生成" value="21"></el-option>
            <el-option label="冲红" value="22"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="创建报台日期">
          <el-date-picker
            v-model="createDate"
            value-format="yyyy-MM-dd HH:mm:ss"
            type="daterange"
            range-separator="至"
            :default-time="['00:00:00', '23:59:59']"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
          ></el-date-picker>
        </el-form-item>

        <el-form-item class="form-button">
          <!-- <el-button type="text" @click="collapse=!collapse" v-if="height_collapse">
            <span v-if="collapse">
              收起详细查询
              <i class="el-icon-arrow-up" />
            </span>
            <span v-else>
              展开详细查询
              <i class="el-icon-arrow-down" />
            </span>
          </el-button>-->
          <el-button type="primary" @click="queryFormQuery">查询</el-button>
          <el-button @click="queryFormReset">重置</el-button>
        </el-form-item>
        <div class="clear"></div>
      </el-form>
    </div>
    <section class="el-container container-box is-vertical">
      <div class="operate">
        <el-button type="primary" size="mini" @click="exportEx">部分导出</el-button>
        <el-button type="primary" size="mini" @click="exportExAll">全部导出</el-button>
      </div>
      <el-editable
        row-key="orderId"
        :data="payload.content"
        height="400"
        stripe
        ref="tableRef"
        v-loading="tableLoading"
        :columns="listColumns"
        :payload="payload"
        :needPagination="true"
        @reload="reloadProductData"
        @selection-change="selectionChange"
      >
        <template slot="default-operation" slot-scope="scope">
          <el-button type="text" @click="checkDetail(scope.row)">详情</el-button>
        </template>
      </el-editable>
    </section>
  </div>
</template>

<script src="./index.js"></script>

<style lang="less" src="./index.less" scoped></style>
